import java.util.concurrent.CountDownLatch;

public class Waiting implements Runnable{
    private CountDownLatch cl;
    private int sum;
    private double account;
    private Account from;
    public Waiting(CountDownLatch cl){
        this.cl = cl;
    }
    public void setSum(int sum){
        this.sum = sum;
    }
    public void setAccount(double account){
        this.account = account;
    }
    public void setFrom(Account from){
        this.from = from;
    }
    public void run(){
            try {
                System.out.println("开始统计+++++++++++++++++");
                cl.await();
                System.out.println("总共计划转账"+sum+"元+++++++++++++++");
                System.out.println("总共实际转账"+account+"元+++++++++++++++");

                System.out.println("成功任务："+from.getSucStr());
                System.out.println("失败任务:"+from.getDeductStr());
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
    }
}
